<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<% String cpath = request.getContextPath(); %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>쿠폰상세보기</title>
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<link href="<%=cpath%>/resources/css/coupon_css.css" rel="stylesheet" type="text/css">

<script type="text/javascript">
function del(coupon_num){
	
	if(confirm("삭제하시겠습니까?")){
		$.ajax({
		  url:'<%=cpath %>/coupon/delete',
		  dataType:'html',
		  type:'get',
		  data: {coupon_num:coupon_num},
		  success: function(data) {
		  	alert("삭제되었습니다.");
		  	location.href="list?curPage=${listDTO.curPage}";   /*삭제후 해당페이지 리스트로 이동 (리스트에서 삭제여부재확인)*/
		  },
		  error:function(){
		  	alert("삭제실패!!");
		  }
		}); 
	}
	<%--if(confirm("삭제하시겠습니까?"))
	 location.href="<%=cpath %>/coupon/delete?coupon_num="+coupon_num; --%>
}
</script>

</head>
<body>
<form id="coupon" name="coupon" method="get"> 
<table width="375" height="475" align="center" border="0" cellspacing="1" bgcolor="#FFC0CB">
  <tr>
  	<td colspan="2" bgcolor="#FFFFFF">
  	  <span class="style1">쿠폰정보</span></td>
  </tr>
  
  <tr>
    <td bgcolor="ffffff">쿠폰번호</td>
    <td bgcolor="ffffff">${dto.coupon_num }</td>
  </tr>
  <tr>
    <td bgcolor="ffffff">쿠폰명</td>
    <td bgcolor="ffffff">${dto.coupon_name }</td>
  </tr>
  <tr>
    <td bgcolor="ffffff">유의사항</td>
    <td bgcolor="ffffff">${dto.coupon_notice }</td>
  </tr>
  <tr>
    <td bgcolor="ffffff">시작일</td>
    <td bgcolor="ffffff">${dto.coupon_enddate }</td>
  </tr>
  <tr>
    <td bgcolor="ffffff">종료일</td>
    <td bgcolor="ffffff">${dto.coupon_enddate }</td>
  </tr>
  <tr>
    <td bgcolor="ffffff">상세</td>
    <td bgcolor="ffffff">${dto.coupon_details }</td>
  </tr>
  <tr>
    <td bgcolor="ffffff">할인율</td>
    <td bgcolor="ffffff">${dto.coupon_discount }</td>
  </tr>
  <tr>
    <td bgcolor="ffffff">조회수</td>
    <td bgcolor="ffffff">${dto.coupon_readcnt }</td>
  </tr>  
  <tr>
    <td bgcolor="ffffff">이미지</td>
    <td bgcolor="ffffff"><img src="/food/resources/coupon/${dto.coupon_image}" width="200" height="200"></td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="ffffff">
    <input type="button" value="수정" onClick="location.href='<%=cpath %>/coupon/updatePage?coupon_num=${dto.coupon_num }&curPage=${listDTO.curPage}'" />&nbsp;
    <input type="button" value="삭제" onClick="javascript:del(${dto.coupon_num })">&nbsp;
    <input type="Button" value="목록" onClick="location.href='<%=cpath %>/coupon/list?curPage=${listDTO.curPage}'" >
    </tr>
</table>
</form>
</body>
</html>